﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using Domain.Common;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace UIComponentSprite.Date
{
    /// <summary>
    /// 季节
    /// </summary>
    public class SeasonSprite:UserControlledSprite
    {
        private string _currentSeason;//当前季节
        public SeasonSprite()
        {
            this.Showing = true;
           DrawPosition.Width = 51;
           DrawPosition.Height = 51;
            DrawPosition.X = 20;
            DrawPosition.Y = 9;
       }
        public override void Draw(GameTime gameTime)
        {
            if (!Showing)
                return;
            SpriteBatch.Draw(this.Image, DrawPosition, Color.White);
        }

        public override void Update(GameTime gameTime)
        {
            if (!Showing)
                return;
            LoadPic();
        }

        protected override void LoadPic()
        {
            if (this._currentSeason != HistoryDate.GetSeason())
            {
                switch (HistoryDate.GetSeason())
                {
                    case "春":
                        this.ImgUrl = @"Images\views\date\Spring";break;
                    case "夏":
                        this.ImgUrl = @"Images\views\date\Summer"; break;
                    case "秋":
                        this.ImgUrl = @"Images\views\date\Autumn"; break;
                    case "冬":
                        this.ImgUrl = @"Images\views\date\Winter"; break;
                }
                this.Image = Game.Content.Load<Texture2D>(this.ImgUrl);
            }

              
        }
    }
}
